/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.produce;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.talent.util.data.PdfUtil;
import cn.javaxc.mes.mapper.produce.ProDeviceMapper;
public class ProDeviceAction extends BaseAction
{
    @Autowired(required=false)
	private ProDeviceMapper mapper;
    /**
    统计图
    */
    
    public Map cartogramProductionDevice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        super.listDepartments();
        
        
        SQLList<SQLMap> all=mapper.all(params);
        result.put("all", all);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    */
    
    public Object produce_info() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> produce_info=mapper.produce_info(params,pagination);
        produce_info.setPagedListInfo(pagination);
        result.put("produce_info", produce_info);
        
        return produce_info;
    }
    /**
    增加新生产设备
    */
    
    public Map devAddNew() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> abrasives=mapper.abrasives(params);
        result.put("abrasives", abrasives);
        
        
        SQLList<SQLMap> fixture=mapper.fixture(params);
        result.put("fixture", fixture);
        
        
        
        
        SQLList<SQLMap> s_sname=mapper.s_sname(params);
        result.put("s_sname", s_sname);
        
        
        result.put("produce_device", create_code(getParameter("CMID5"),"produce_barcode"));
        
        
        SQLList<SQLMap> s_mname=mapper.s_mname(params);
        result.put("s_mname", s_mname);
        
        
        SQLList<SQLMap> s_product_info=mapper.s_product_info(params);
        result.put("s_product_info", s_product_info);
        
        return result;
    }
    /**
    生产设备饼状统计图
    */
    
    public Map productionEquipmentPro() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> s_c=mapper.s_c(params);
        result.put("s_c", s_c);
        
        return result;
    }
    /**
    采购信息
    */
    
    public Map purchaseDet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_pur=mapper.t_pur(params);
        SQLMap t_pur_emt=t_pur.getExistfirst();
        result.put("t_pur", t_pur_emt);
        
        return result;
    }
    /**
    修改采购
    */
    
    public Map modifyProcurementPro() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_pur=mapper.t_pur(params);
        SQLMap t_pur_emt=t_pur.getExistfirst();
        result.put("t_pur", t_pur_emt);
        
        return result;
    }
    /**
    验收信息
    */
    
    public Map checkDet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_check=mapper.t_check(params);
        SQLMap t_check_emt=t_check.getExistfirst();
        result.put("t_check", t_check_emt);
        
        return result;
    }
    /**
    修改信息
    */
    
    public Map modifyInformation() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_check=mapper.t_check(params);
        SQLMap t_check_emt=t_check.getExistfirst();
        result.put("t_check", t_check_emt);
        
        return result;
    }
    /**
    记录配置
    */
    
    public Map recordConfiguration() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_menu=mapper.s_menu(params);
        result.put("s_menu", s_menu);
        
        return result;
    }
    /**
    设备记录
    */
    
    public Map deviceRecord() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        
        
        SQLList<SQLMap> s_work=mapper.s_work(params);
        result.put("s_work", s_work);
        
        return result;
    }
    /**
    增加质量记录
    */
    
    public Map deviceRecordAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object CMCLASSID =mapper.CMCLASSID(params);
        result.put("CMCLASSID", CMCLASSID);
        
        
        SQLList<SQLMap> s_record_table=mapper.s_record_table(params);
        SQLMap s_record_table_emt=s_record_table.getExistfirst();
        result.put("s_record_table", s_record_table_emt);
        
        return result;
    }
    /**
    质量记录明细
    */
    
    public Map deviceRecordDet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_work=mapper.s_record_work(params);
        SQLMap s_record_work_emt=s_record_work.getExistfirst();
        result.put("s_record_work", s_record_work_emt);
        
        
        SQLList<SQLMap> record=mapper.record(params);
        result.put("record", record);
        
        return result;
    }
    /**
    修改质量记录
    */
    
    public Map deviceRecordUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_work=mapper.s_record_work(params);
        SQLMap s_record_work_emt=s_record_work.getExistfirst();
        result.put("s_record_work", s_record_work_emt);
        
        
        SQLList<SQLMap> record=mapper.record(params);
        result.put("record", record);
        
        return result;
    }
    /**
    增加条形码规则
    */
    
    public Map codeAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_bc=mapper.s_bc(params);
        SQLMap s_bc_emt=s_bc.getExistfirst();
        result.put("s_bc", s_bc_emt);
        
        return result;
    }
    /**
    生产设备搜索
    */
    
    public Map deviceSearch() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> abrasives=mapper.abrasives(params);
        result.put("abrasives", abrasives);
        
        
        SQLList<SQLMap> fixture=mapper.fixture(params);
        result.put("fixture", fixture);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        
        
        return result;
    }
    /**
    搜索结果
    */
    
    public Map deviceSearchList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> produce_info=mapper.produce_info(params,pagination);
        produce_info.setPagedListInfo(pagination);
        result.put("produce_info", produce_info);
        
        return result;
    }
    /**
    */
    
    public Map d_pb() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_pb(params);
        
        return result;
    }
    /**
    增加新生产设备修改
    */
    
    public Map devAddNewSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        
        int i_pack = mapper.i_pack(params);
        result.put("i_pack", i_pack);
        
        return result;
    }
    /**
    采购信息修改
    */
    
    public Map purchaseDetSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.purchaseDetSubmit(params);
        
        return result;
    }
    /**
    修改采购修改
    */
    
    public Map modifyProcurementProSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.modifyProcurementProSubmit(params);
        
        return result;
    }
    /**
    验收信息修改
    */
    
    public Map checkDetSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.checkDetSubmit(params);
        
        return result;
    }
    /**
    修改信息修改
    */
    
    public Map modifyInformationSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.modifyInformationSubmit(params);
        
        return result;
    }
    /**
    */
    
    public Map d_work() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_work(params);
        
        return result;
    }
    /**
    增加质量记录修改
    */
    
    public Map deviceRecordAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMIDrecord_work_id = mapper.CMIDrecord_work_id(params);
        result.put("CMIDrecord_work_id", CMIDrecord_work_id);
        
        
        mapper.deviceRecordAddSubmit(params);
        
        
        for (SQLMap emt:SQL.foreach(hqlBean.getRecord(),"name","value")){
            params=new SQLParam(request,emt.getMap());
            mapper.b_item_work(params);
        }
        
        return result;
    }
    /**
    */
    
    public Map onInsertFile() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object name =
        mapper.name(params);
        result.put("name", name);
        
        
        PdfUtil.writePdfContext(context,name+".pdf");
        
        return result;
    }
    /**
    修改质量记录修改
    */
    
    public Map deviceRecordUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.deviceRecordUpSubmit(params);
        
        
        for (SQLMap emt:SQL.foreach(hqlBean.getRecord(),"name","value")){
            params=new SQLParam(request,emt.getMap());
            mapper.b_item_work(params);
        }
        
        return result;
    }
    /**
    增加新分类修改
    */
    
    public Map devClassAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int i_device_class = mapper.i_device_class(params);
        result.put("i_device_class", i_device_class);
        
        return result;
    }
    /**
    增加条形码规则修改
    */
    
    public Map codeAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int bc_id = mapper.bc_id(params);
        result.put("bc_id", bc_id);
        
        return result;
    }
    public Map ajaxList(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(request.getParameter("cfield_name").contains("product_info")){
            SQLList<SQLMap> product_info=mapper.product_info(params);
            result.put("product_info", product_info);
        }
        
        return result;
    }
}